<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //1.如果展开一个空对象，则没有任何效果
    console.log({...{},...{a:1}});
    //2.如果展开的不是对象，则会自动将其转为对象，再将其属性罗列出来
    console.log({...1});
    console.log({...undefined});
    console.log({...true});
    console.log({...null});
    //如果展开运算符后面是字符串，它会自动转为一个类数组的对象。因此返回的不是空对象
    console.log(...'alex');
    console.log({...'abc'});
    console.log([...'gkl']);
    console.log({...[1,2,3]});
    //不会展开对象中的对象属性
    const person={a:{b:1},c:2}
    const dog={1:{2:3}}
    console.log({...person,...dog});
  </script>
  

</body>
</html>